package com.wrong.desgin.applicaiton;

import com.wrong.desgin.RedisUtils;

import java.util.concurrent.TimeUnit;

/**
 * @author: hliushi
 * @date: 2022/12/5 22:46
 **/
public class CacheServiceImpl implements CacheService {

    /**
     * 原本是使用单体的 redis, 需要兼容升级到 Redis 集群中
     */
    private RedisUtils redisUtils = new RedisUtils();

    @Override
    public Object get(String key) {
        return redisUtils.get(key);
    }

    @Override
    public void set(String key, Object value) {
        redisUtils.set(key, value);
    }

    @Override
    public void set(String key, Object value, long timeout, TimeUnit unit) {
        redisUtils.set(key, value, timeout, unit);
    }

    @Override
    public void del(String key) {
        redisUtils.del(key);
    }
}
